import 'package:gold/generated/json/base/json_field.dart';
import 'dart:convert';

import 'package:gold/generated/json/point_list_model.g.dart';

@JsonSerializable()
class PointListModel {
	List<PointModel>? data;
	int? total;
	int? count;
	@JSONField(name: 'per_page')
	int? perPage;
	@JSONField(name: 'current_page')
	int? currentPage;
	@JSONField(name: 'total_pages')
	int? totalPages;

	PointListModel();

	factory PointListModel.fromJson(Map<String, dynamic> json) => $PointListModelFromJson(json);

	Map<String, dynamic> toJson() => $PointListModelToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}

@JsonSerializable()
class PointModel {
	int? id;
	@JSONField(name: 'user_id')
	int? userId;
	/// 积分变动
	int? points;
	/// 金额
	@JSONField(name: 'current_amount')
	int? currentAmount;
	/// 来源
	String? reason;
	/// 订单id
	@JSONField(name: 'order_id')
	int? orderId;
	/// 更新时间
	@JSONField(name: 'created_at')
	String? createdAt;

	PointModel();

	factory PointModel.fromJson(Map<String, dynamic> json) => $PointModelFromJson(json);

	Map<String, dynamic> toJson() => $PointModelToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}